#ifndef DISPLAY_COMMON_H
#define DISPLAY_COMMON_H

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include <va/va.h>

#include <va/va_x11.h>
#include <X11/Xlib.h>

#include <va/va_backend.h>

#include "intel_batchbuffer.h"
#include "intel_driver.h"
#include "i965_defines.h"
#include "i965_structs.h"
#include "i965_drv_video.h"
#include "display.h"
#include "i965_render.h"

#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)

#define CHECK_VASTATUS(va_status,func)                                  \
if (va_status != VA_STATUS_SUCCESS) {                                   \
    fprintf(stderr,"%s:%s (%d) failed,exit\n", __func__, func, __LINE__); \
    exit(1);                                                            \
}

void wzyPrintFlag(int flag);

VASurfaceID setup_pipeline(VADriverContextP ctx, unsigned width, unsigned height);

void display_init(VADriverContextP ctx);

void display_terminate(VADriverContextP ctx, VASurfaceID * surface);

#endif
